-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extending contract #319
Extending contract #319
Conversation
? "./build/counter-ts.wasm" | ||
: "./build/counter.wasm" | ||
); | ||
const counter = await root.devDeploy(counterContract); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a test for reset
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I didn't see this:
Note 1: now it does not work, functions from the parent class are not generated or exported.
NearBindgen doesn't walk through parent class, it may be possible to identify extends pattern in our babel pass then recursively NearBindgen on parent class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it should be possible (not tested), the question is - is it the best approach? I will experiment with this.
Closing in favor of #325 |
Let's define if we want our contract to be extendable. Looks good, but it can lead to some issues with code generation (@waynenilsen ) and ABI (cc @itegulov).
@MaximusHaximus what is your opinion on this? Previously your advice was to avoid class extensions. But contract composability is a cool feature to have.
Note 1: now it does not work, functions from the parent class are not generated or exported.
Note 2: In Rust composability is achieved with macros: https://github.com/near/near-sdk-rs/blob/master/examples/non-fungible-token/nft/src/lib.rs#L103
Not something users want I think, especially in JS projects.
cc @ailisp